package com.bxmdm.ragdemo.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * RAG测试配置类
 * 用于控制不同的搜索策略和参数
 */
@Component
@ConfigurationProperties(prefix = "rag.test")
public class RAGTestConfig {

    // 是否启用加权向量
    private boolean enableWeightedEmbedding = true;

    // 第一句话的权重倍数
    private double firstSentenceWeight = 3.0;

    // 关键语义句子权重倍数
    private double keySemanticWeight = 1.5;

    // 问号结尾句子权重倍数
    private double questionEndingWeight = 1.3;

    // 引号句子权重倍数
    private double quotedSentenceWeight = 1.2;

    // 最小句子权重
    private double minSentenceWeight = 0.3;

    // 权重递减因子
    private double weightDecayFactor = 0.1;

    // 搜索结果数量倍数（用于过采样后筛选）
    private int searchMultiplier = 2;

    // 相似度阈值
    private double similarityThreshold = 0.1;

    // 测试模式（用于A/B测试）
    private TestMode testMode = TestMode.WEIGHTED;

    public enum TestMode {
        WEIGHTED, // 使用加权向量
        NON_WEIGHTED, // 不使用加权向量
        MIXED // 混合模式，用于对比测试
    }

    // Getters and Setters
    public boolean isEnableWeightedEmbedding() {
        return enableWeightedEmbedding;
    }

    public void setEnableWeightedEmbedding(boolean enableWeightedEmbedding) {
        this.enableWeightedEmbedding = enableWeightedEmbedding;
    }

    public double getFirstSentenceWeight() {
        return firstSentenceWeight;
    }

    public void setFirstSentenceWeight(double firstSentenceWeight) {
        this.firstSentenceWeight = firstSentenceWeight;
    }

    public double getKeySemanticWeight() {
        return keySemanticWeight;
    }

    public void setKeySemanticWeight(double keySemanticWeight) {
        this.keySemanticWeight = keySemanticWeight;
    }

    public double getQuestionEndingWeight() {
        return questionEndingWeight;
    }

    public void setQuestionEndingWeight(double questionEndingWeight) {
        this.questionEndingWeight = questionEndingWeight;
    }

    public double getQuotedSentenceWeight() {
        return quotedSentenceWeight;
    }

    public void setQuotedSentenceWeight(double quotedSentenceWeight) {
        this.quotedSentenceWeight = quotedSentenceWeight;
    }

    public double getMinSentenceWeight() {
        return minSentenceWeight;
    }

    public void setMinSentenceWeight(double minSentenceWeight) {
        this.minSentenceWeight = minSentenceWeight;
    }

    public double getWeightDecayFactor() {
        return weightDecayFactor;
    }

    public void setWeightDecayFactor(double weightDecayFactor) {
        this.weightDecayFactor = weightDecayFactor;
    }

    public int getSearchMultiplier() {
        return searchMultiplier;
    }

    public void setSearchMultiplier(int searchMultiplier) {
        this.searchMultiplier = searchMultiplier;
    }

    public double getSimilarityThreshold() {
        return similarityThreshold;
    }

    public void setSimilarityThreshold(double similarityThreshold) {
        this.similarityThreshold = similarityThreshold;
    }

    public TestMode getTestMode() {
        return testMode;
    }

    public void setTestMode(TestMode testMode) {
        this.testMode = testMode;
    }
}
